#include<vector>
#include<algorithm>
using namespace std;
class Solution
{
public:
    int maxArea(vector<int> &height)
    {
        int l = 0, r = height.size() - 1;
        int res = 0;
        while (l < r)
        {
            int cur = min(height[r], height[l]);
            res = max(res, cur * (r - l));
            cur == height[l] ? l++ : r--;
        }
        return res;
    }
};